package com.yan.utils;

import java.util.HashMap;
import java.util.Map;

public class EnumUtil {

	public enum ChatResult {
		BLOCKED_LIST(1010, "您已被禁言"), 
		SUCCESS(1000, "发送成功"), 
		WORD_LIMIT(1011, "发送失败，字数超过限制"), 
		MSG_ID_NULL(1012, "msgId不能为空"), 
		USER_VALIDATE_FAIL(1013, "用户登录校验失败"), 
		REPORT_USER_NOT_EXIST(1014, "被举报用户不存在"),
		MSG_CODE_NULL(1015, "msgCode不能为空"),
		DESIGNATE_USER_NOT_EXIST(1016, "@用户不存在"),
		EXIST_MSG_ID(1018, "msgId已存在"),
		INTEGRATION_PLATFORM_CONNECTION_REFUSE(1017, "综合平台ice连接失败");
		

		private int resultCode;

		private String resultMsg;

		public int getResultCode() {
			return resultCode;
		}

		public void setResultCode(int resultCode) {
			this.resultCode = resultCode;
		}

		public String getResultMsg() {
			return resultMsg;
		}

		public void setResultMsg(String resultMsg) {
			this.resultMsg = resultMsg;
		}

		ChatResult(int resultCode, String resultMsg) {
			this.resultCode = resultCode;
			this.resultMsg = resultMsg;
		}
	}
	
	
	public enum ChatType {

		BASKETBALL("basketball"), FOOTBALL("football"), PUBLIC("public"), SNOOKER("snooker"), TENNIS(
				"tennis"), CHAT_USER_INFO("mobile:user:login:{0}");

		ChatType(String type) {
			this.type = type;
		}

		private String type;

		public String getType() {
			return type;
		}

		public void setType(String type) {
			this.type = type;
		}

		private static final Map<String, ChatType> map = new HashMap<String, ChatType>();
		static {
			for (ChatType chatType : values()) {
				map.put(chatType.type, chatType);
			}
		}

		public static ChatType fromString(String type) {
			return map.get(type);
		}

	}

	public static void main(String args[]){
		System.out.println(EnumUtil. ChatResult.BLOCKED_LIST.resultCode +EnumUtil. ChatResult.BLOCKED_LIST.resultMsg);
		System.out.println(EnumUtil.ChatType.BASKETBALL.name()+EnumUtil.ChatType.BASKETBALL.getType()+ChatType.fromString("basketball"));
	}
}
